package com.xiao.mall.message.domain;

import com.xiao.mall.foundation.entity.AbstractAuditingEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;

import static javax.persistence.GenerationType.IDENTITY;

@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_user_notification")
@EqualsAndHashCode(callSuper = false)
@SuperBuilder
@Getter
@Setter
public class UserNotification extends AbstractAuditingEntity implements Serializable {

    private static final long serialVersionUID = 8878043710678024808L;

    @Id
    @GeneratedValue(strategy = IDENTITY)
    private Long id;

    @Builder.Default
    @Column
    private Boolean hasRead = false;

    @Column(length = 20)
    private String userId;

    @Column(length = 20)
    private String mobile;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "notification_id", referencedColumnName = "id")
    private Notification notification;

    @Builder.Default
    @Column
    private Boolean disabled = false;
}
